﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ConceptCorporateAdmin.Gui.Dialogs
{
    public partial class LinkActNormativ : Form
    {
        private int raspuns = -1;

        public LinkActNormativ()
        {
            InitializeComponent();
            //incarca lista de acte normative si categorii
            TvLista.RefreshLista();
        }

        public static int ShowMe()
        {
            LinkActNormativ dlg = new LinkActNormativ();
            dlg.ShowDialog();
            dlg.Close();
            return dlg.raspuns;
        }

        private void TvLista_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (TvLista.SelectedExNode != null)
            {
                if (TvLista.SelectedExNode.TipNod == TipuriNoduri.ActeNormative)
                {
                    DbActNormativ act_normativ = (DbActNormativ)TvLista.SelectedExNode.InnerObject;
                    raspuns = act_normativ.Id;
                }
                else
                    raspuns     = -1;
            }
        }

        private void BtnOk_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void BtnRenunta_Click(object sender, EventArgs e)
        {
            raspuns = -1;
            Close();
        }
        

    }
}
